/**
 * jims
 */
package com.jims.master.modules.med.service;

import com.jims.master.common.persistence.Page;
import com.jims.master.common.service.CrudService;
import com.jims.master.modules.med.dao.MedicalCardChangeLogDao;
import com.jims.master.modules.med.entity.MedicalCardChangeLog;
import com.jims.master.modules.sys.utils.UserUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 一卡通办理日志Service
 * @author 陈晓阳
 * @version 2017-05-22
 */
@Service
@Transactional(readOnly = true)
public class MedicalCardChangeLogService extends CrudService<MedicalCardChangeLogDao, MedicalCardChangeLog> {

    @Autowired
	private MedicalCardChangeLogDao medicalCardChangeLogDao;


    public MedicalCardChangeLog get(String id) {
		return super.get(id);
	}
	
	public List<MedicalCardChangeLog> findList(MedicalCardChangeLog medicalCardChangeLog) {
		return super.findList(medicalCardChangeLog);
	}
	
	public Page<MedicalCardChangeLog> findPage(Page<MedicalCardChangeLog> page, MedicalCardChangeLog medicalCardChangeLog) {
		return super.findPage(page, medicalCardChangeLog);
	}
	
	@Transactional(readOnly = false)
	public int save(MedicalCardChangeLog medicalCardChangeLog) {
		return super.save(medicalCardChangeLog);
	}
	
	@Transactional(readOnly = false)
	public int delete(MedicalCardChangeLog medicalCardChangeLog) {
		return super.delete(medicalCardChangeLog);
	}

    /**
     * 退卡统计
     * @param startTime
     * @param endTime
     * @return
     */
    public MedicalCardChangeLog countReturnCard(String startTime, String endTime) {
        return medicalCardChangeLogDao.countReturnCard(startTime,endTime, UserUtils.getUser().getId());
    }
}